﻿using BPMN.Application.Contracts.DTO.Request.Menu;
using BPMN.Application.Contracts.DTO.Response;
using BPMN.Application.IService;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BPMN.WebApi.Controllers
{
    [Route("api/[controller]action")]
    [ApiController]
    public class MenuController : ControllerBase
    {

        private readonly IMenuAppService menuAppService;

        public MenuController(IMenuAppService menuAppService)
        {
            this.menuAppService = menuAppService;
        }



        [HttpGet]
        public async Task<IActionResult> GetMenuById(int Id)
        {
            return Ok(await menuAppService.GetMenuById(Id));

        }


        [HttpPost]
        public async Task<IActionResult> AddMenu(MenuShowDto menu)
        {
            return Ok(await menuAppService.AddMenu(menu));
        }


        [HttpPut]
        public async Task<IActionResult> UpdateMenu(MenuShowDto entity)
        {
            return Ok(await menuAppService.UpdateMenu(entity));
        }
    }
}
